import axios from '@/libs/api.request'
import qs from 'querystring'
export const queryList=async (queryParams)=>{
  let params=qs.stringify(queryParams)
  return (await axios.request({
    url: '/course/list?'+params,
    method: 'get'
  })).data.data
}

export const  getAllCourse = async () => {
  return (await axios.request({
    url: '/course/search',
    method: 'get'
  })).data.data
}

export const create = async (course) => {
  let data = qs.stringify(course)
  return (await axios.request({
    url: '/course/add',
    data,
    method: 'post'
  })).data
}

export const remove = async (ids) => {
  let params = qs.stringify({ ids })
  return (await axios.request({
    url: '/course/delete?' + params,
    method: 'get'
  })).data
}

export const getById = async id => {
  return (await axios.request({
    url: '/course/view',
    params: id,
    method: 'get'
  })).data
}

export const update = async course => {
  let data = qs.stringify(course)
  return (await axios.request({
    url: '/course/update',
    data,
    method: 'post'
  })).data
}
